package ft.app.gtig.entity;

import javax.persistence.Entity;
import javax.persistence.Table;
import com.haulmont.cuba.core.entity.StandardEntity;
import javax.persistence.Column;
import com.haulmont.cuba.core.entity.BaseUuidEntity;
import com.haulmont.cuba.core.entity.Updatable;
import com.haulmont.cuba.core.entity.annotation.OnDeleteInverse;
import com.haulmont.cuba.core.global.DeletePolicy;
import com.haulmont.cuba.security.entity.User;

import java.util.Date;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Table(name = "GTIG_EVENT_HIGHLIGHT")
@Entity(name = "gtig$EventHighlight")
public class EventHighlight extends BaseUuidEntity implements Updatable {
    private static final long serialVersionUID = -8815017541005656361L;

    @Column(name = "PRE_COLOR", nullable = false)
    protected String preColor;

    @Column(name = "DESCRIPTION", nullable = false, length = 500)
    protected String description;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TIMELINE_EVENT_ID")
    protected TimelineEvent timelineEvent;

    @Column(name = "SORT", nullable = false)
    protected Integer sort;

    @Column(name = "UPDATE_TS")
    protected Date updateTs;

    @Column(name = "UPDATED_BY", length = 50)
    protected String updatedBy;

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getSort() {
        return sort;
    }


    public ColorEnum getPreColor() {
        return preColor == null ? null : ColorEnum.fromId(preColor);
    }

    public void setPreColor(ColorEnum preColor) {
        this.preColor = preColor == null ? null : preColor.getId();
    }


    public void setTimelineEvent(TimelineEvent timelineEvent) {
        this.timelineEvent = timelineEvent;
    }

    public TimelineEvent getTimelineEvent() {
        return timelineEvent;
    }


    @Override
    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    @Override
    public String getUpdatedBy() {
        return updatedBy;
    }

    @Override
    public void setUpdateTs(Date updateTs) {
        this.updateTs = updateTs;
    }

    @Override
    public Date getUpdateTs() {
        return updateTs;
    }


    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }


}